home *** CD-ROM | disk | FTP | other *** search
/ WINMX Assorted Textfiles / Ebooks.tar / Text - Tech - Programming - Visual Basic - Commands.txt < prev    next >
Text File  |  2003-10-15  |  25KB  |  476 lines

  1. Here are the VB operators used to perform mathematical operations on one or more variables. Aside from the normal multiply/add/substract and divide, you will find the AND, OR, Not Equal, MOD and Integer Division operators very useful.
  2.  
  3. / - Normal division 
  4. \ - Integer division (truncates the answer) 
  5. ^ - Exponentiation operator 
  6. * - Multiply 
  7. + - Plus 
  8. - - Minus 
  9. = - Equal 
  10. > - Greater Than 
  11. < - Less Than 
  12. <> - Not Equal 
  13. >= - Greater than or equal 
  14. <= - Less than or equal 
  15. AND - Defines a boolean value that is the AND of two values 
  16. result = expression1 AND expression2 
  17. OR - Defines a boolean value that is the OR of two values 
  18. result = expression1 OR expression2 
  19. XOR - Defines a boolean value that is the exclusive OR of two values 
  20. result = expression1 XOR expression2 
  21. NOT - Defines an opposite boolean value 
  22. A = NOT B 
  23. EQV - Performs a logical equivalence on two expressions (result is true if both expressions are true) 
  24. result = expression1 EQV expression2 
  25. IMP - Performs a logical implication on two expressions 
  26. result = expression1 IMP expression2 
  27. IS - Determines if 2 variables reference the same object 
  28. result = object1 IS object2 
  29. LIKE - Determines if one string matches a pattern 
  30. result = string LIKE pattern 
  31. MOD - Returns the integer remainder of a division 
  32. i = 27 MOD 5 
  33. Math
  34. VB also provides built-in functions which can act on variables. Most are self-explanatory. In my experience, the VAL, RND, and ROUND functions are among the most valuable, so be sure to pay close attention to them!
  35.  
  36. Round - Rounds a number to a selectable number of decimal places 
  37. result = round ( tempvariable,2 ) 
  38. Val - Returns the numerical content of a string 
  39. result = Val ("123.4") 
  40. Int - Returns an integer by truncating (different than Fix) 
  41. i = int ( tempvariable ) 
  42. Fix - Returns an integer by truncating (different than Int) 
  43. i = fix ( tempvariable ) 
  44. Hex - Returns the hexadecimal value of any number 
  45. temp$ = hex ( tempvariable ) 
  46. Oct - Returns the octal value of any number 
  47. temp$ = oct ( tempvariable ) 
  48. Tan - Returns the tangent of an angle 
  49. tempvariable1 = tan ( tempvariable2 ) 
  50. Rnd - Returns a random number between 0 and 1 
  51. tempvariable1 = rnd 
  52. Randomize - Initializes the Rnd function so it gives different answers each time 
  53. randomize 
  54. Sgn - Returns the sign of a number 
  55. i = sgn ( tempvariable ) 
  56. Sin - Returns the sine of an angle 
  57. tempvariable1 = sin ( tempvariable2 ) 
  58. Cos - Returns the cosine of an angle 
  59. tempvariable2 = cos ( tempvariable ) 
  60. Abs - Converts a number to a positive value 
  61. i = abs ( tempvariable ) 
  62. Sqr - Returns the square root of a number 
  63. tempvariable1 = sqr ( tempvariable2 ) 
  64. Log - Returns the base 10 logarithm of a number 
  65. tempvariable1 = log ( tempvariable2 ) 
  66. Atn - Returns the arctangent of an angle 
  67. tempvariable1 = atn ( tempvariable ) 
  68. Partition - Sort of an oddball function but segregates values according to ranges 
  69.   
  70. Type Conversions - A variety of conversion functions 
  71. CBool, CByte, CCur, CDate, CDbl, CDec, CInt, CLng, CSng, CStr, CVar 
  72. Strings
  73. In my experience these functions are used more than just about any of the other VB built-in functions. The FORMAT, MID, and INSTR functions are incredibly powerful and I use them extensively. If you don't understand what they are, they are worth the time to figure out! The LEN and CHR functions are also valuable as are the variations on the trim and case functions.
  74.  
  75. Left - Returns the left n characters of a string 
  76. temp$ = left$ ( teststring$, 4 ) 
  77. Right - Returns the right n characters of a string 
  78. temp$ = right$ ( teststring$, 4 ) 
  79. Trim - Removes leading and trailing spaces of a string 
  80. temp$ = trim$ ( teststring$ ) 
  81. LTrim - Removes only the leading spaces of a string 
  82. temp$ = ltrim$ ( teststring$ ) 
  83. RTrim - Removes only the trailing spaces of a string 
  84. temp$ = rtrim$ ( teststring$ ) 
  85. UCase - Makes all characters upper case 
  86. temp$ = ucase$ ( teststring$ ) 
  87. LCase - Makes all characters lower case 
  88. temp$ = lcase$ ( teststring$ ) 
  89. Mid - Returns n characters from a string, starting a any position 
  90. temp$ = mid$ ( teststring$, 1, 4 ) 
  91. Len - Returns the length of a string (how many characters it has) 
  92. temp$ = len ( teststring$ ) 
  93. LSet - Positions a string inside another, flush to the left 
  94. temp$ = lrset ( teststring$ ) 
  95. RSet - Positions a string inside another, flush to the right 
  96. temp$ = rset$ ( teststring$ ) 
  97. Format - Returns a string formatted according to a user-defined format 
  98. temp$ = format$ ( teststring$, "####.0" ) 
  99. String - 
  100. temp$ = left$ ( teststring$, 4 ) 
  101. Chr - Returns the string representation of a number 
  102. temp$ = str$ ( 32 ) 
  103. Asc - Returns the ASCII code of a single character 
  104. temp$ = asc ( "A" ) 
  105. Space - Returns n spaces 
  106. temp$ = space$ ( 15 ) 
  107. Instr - Determines if one string is found within a second string 
  108. i = Instr (starthere, string1, string2) 
  109. InStrRev - Determine if one string is found in a second, starting at the end 
  110. i = InStrRev (string1, string2, start) 
  111. StrComp - Compares two strings 
  112. result = StrComp (string1, string2) 
  113. StrConv - Converts the case of a string's characters 
  114. StrConv (string, vbuppercase) 
  115. StrReverse - Reverses character order in a string 
  116. StrReverse (string1) 
  117. Replace - Replaces each occurrence of a string 
  118. Replace (bigstring, searchstring, replacementstring) 
  119. FormatCurrency - Returns a string using a currency format 
  120. FormatCurrency(var1, 2) 
  121. FormatDateTime - Returns a date or time expression 
  122. FormatDateTime("3/2/99",vbShortTime) 
  123. FormatNumber - Returns a number formatted according to a variety of options 
  124. FormatNumber(var1, 2) 
  125. FormatPerCent - Returns a number formated as a percent 
  126. FormatPerCent(var1, 2) 
  127. Arrays
  128. Every programmer eventually uses arrays. Mostly they're pretty easy to understand. Take note, however, that you can resize an array with REDIM without losing the data. For details, see the PRESERVE keyword in the HELP entry on REDIM. If you use the LBound/UBound in your code instead of hard-coding the dimension of the array, you can later change the size of the array without touching your code!
  129.  
  130. Option Base - Determines whether the lowest range of an array is 0 or 1 
  131. option base 1 
  132. Erase - Erases all values of an array 
  133. erase (arrayname) 
  134. Dim - Creates an array 
  135. dim arrayname(25) 
  136. Redim - Resets the bounds of an array (has option to save values) 
  137. redim arrayname(28) 
  138. UBound - Returns the upper dimension of an array 
  139. i = ubound (arrayname) 
  140. LBound - Returns the lower dimension of an array 
  141. i = lbound (arrayname) 
  142. Filter - Returns a subset of an array based on a filter 
  143. Filter (inputarray, searchstring) 
  144. Array - Yes, there is a function called array. It returns an array that has been filled with data from a list. It allows you to put the actual data values in the code to avoid having the user input it or to avoid having to read it from a file 
  145. ArrayName = Array (10, 20, 30) 
  146. Join - Concatenates strings within an array 
  147. File Handling (Generic)
  148. While VB is working on a better approach (FileSystemObject), the built-in file handling statements are still the only way to access data other than through the VB database capabilities. Your skills in this area can make or break your ability to work with various formats. The OPEN/CLOSE statements are critical to success, but the LOF, EOF, and LEN functions are used even more often! It's also a given that you'll use the DIR function regularly.
  149.  
  150. Dir - Returns a filename that matches a pattern 
  151. temp$ = Dir ("*.*") 
  152. CurDir - Returns the current directory 
  153. temp$ = CurDir 
  154. MkDir - Creates a directory 
  155. mkdir ( "newdirectoryname" ) 
  156. ChDir - Changes the current directory to a new location 
  157. chdir ( "newdirectoryname" ) 
  158. ChDrive - Changes the current drive 
  159. ChDirve "A" 
  160. RmDir - Removes the indicated directory 
  161. rmdir ( "directoryname" ) 
  162. Freefile - Returns an unused file handle 
  163. i = freefile 
  164. Open - Opens a file for access, locking it from other applications 
  165. open "filename" for input as #1 
  166. Close - Closes a file so that other applications may access it 
  167. close #1 
  168. LOF - Returns the length of a file in bytes 
  169. i = lof ( #1 ) 
  170. EOF - Returns a boolean value to indicate if the end of a file has been reached 
  171. statusvariable = eof ( #1 ) 
  172. Name As - Renames a file 
  173. name "filename1" as "filename2" 
  174. Kill - Deletes a file 
  175. kill "filename" 
  176. Fileattr - Returns attribute information about a file 
  177. i = int ( tempvariable ) 
  178. GetAttr - Returns attributes of a file or directory 
  179. i = GetAttr("c:\windows\temp") 
  180. SetAttr - Sets the attributes of a file 
  181. SetAttr pathname, vbHidden 
  182. Reset - Closes all disk files opened by the OPEN statement 
  183. Reset 
  184. FileDateTime - Returns data file was created or last edited 
  185. FileDateTime ( filename ) 
  186. FileLen - Returns length of file in bytes 
  187. FileLen ( filename ) 
  188. FileCopy - Copies a file to a new name 
  189. FileCopy sourcefile, destinationfile 
  190. Lock - Controls access to a part or all of a file opened by OPEN 
  191. Lock #1 
  192. UnLock - Restores access to a part or all of a file opended by OPEN 
  193. UnLock #1 
  194. Width # - Set the output line width used by the OPEN statement 
  195. Width #2, 80 
  196. File Handling - ASCII-specific
  197. While VB is working on a better approach (FileSystemObject), the built-in file handling statements are still the only way to access data outside of a data base. Your skills in this area can make or break your ability to work with various formats. The OPEN/CLOSE statements are critical to success, but the LOF, EOF, and LEN functions are necessary to build useful code.
  198.  
  199. Line Input - Reads an entire line of ASCII text 
  200. line input #1, tempvariable$ 
  201. Write - Puts data in a file, with separators for the data 
  202. write #1, tempvariable$ 
  203. Print - Puts data in a file with no separators 
  204. print #1, tempvariable$ 
  205. Spc - Used in a print statement to move a number of spaces 
  206. Print #2, var1; spc(15); var2 
  207. Tab - Used in a print statement to move to TAB locations 
  208. Print #2, var1; Tab(20); var2 
  209. File Handling - Binary-specific
  210. VB also support features which allow you to access a file on a byte-by-byte basis. The good thing about it is that you have more control, the bad thing is that you may have to write more code. Generally, a programmer will use the option (ASCII or Binary access) according to the least code he has to write. For binary access the Get/Put are equivalent to the Line Input and Print functions used in ASCII text file access. The big difference between the two is that binary access will read (Get) an exact number of bytes of data, and the reading can start at any byte within the file.
  211.  
  212. Get - Reads data from a file 
  213. get #1, anyvariable 
  214. Put - Puts data into a file 
  215. put #1, anyvariable 
  216. Seek - Moves the current pointer to a defined location in a file 
  217. seek #1, 26 
  218. Input 
  219. input #1, anyvariable 
  220. Loc - Returns current position with an open file 
  221. i = Loc(#2) 
  222. Declarations
  223. I probably get more questions about the functions in this section than about any other group. In general, the concepts are pretty simple, but the details of getting it exactly right can cause even experienced programmers trouble. Focus on understanding Dim/ReDim/Public/Private/Sub/Function/Type and Set. However, they're all useful at times, so bear down and commit these to memory. I'll try to add more text and tips on these than I have on the others.
  224.  
  225. Dim - Used to define a variable as a certain type 
  226. i = dim i as integer, r as single 
  227. You can use the Option Explicit to make sure that VB forces you to declare every variable you use. DIM is that simplest way to declare a variable 
  228. ReDim - Used to change the dimensions of a dynamic array 
  229. redim arrayname(37) 
  230. Don't be afraid of this one. You can use ReDim to create an array whose size grows by 1 every time you want to add a number to it. Then, the UBound tells you how many numbers you've added. 
  231. Static - Establishes a procedure variable which keeps its value between calls 
  232. static i as integer 
  233. For example, if you want to keep track of how many times you've been in a procedure, set a counter as STATIC and increment it by one for each visit to the procedure. It will never go away until the program is terminated. 
  234. Public - Creates a variable which can be accessed outside its own procedure 
  235. public i as integer 
  236. Even if you're the only programmer writing code in your application, use of Private vs Public will help catch errors if you inadvertently try to access an out-of-scope variable 
  237. Private - Creates a variable that can be read only in its own procedure or module, according to where the declaration took place. 
  238. private i as integer 
  239. Use this as often as possible to avoid unnecessary exposure of your variables to coding mistakes. 
  240. Sub - Defines a procedure which can execute a block of code 
  241. Sub NewProcedure (var1 as integer, var2 as string) 
  242. Be sure to check out HELP for how to handle Sub arguments. There are more questions and mistakes made concerning the use of arguments than just about anything else I've seen. 
  243. Function - Declares a procedure which can return a value 
  244. Function NewFunction (var1 as integer, var2 as string) as SINGLE 
  245. This is actually the most versatile of the Sub/Function procedure types. It can do anything a Sub can do as well as returning a value for use in an expression. 
  246. Call - Transfers control to a Sub or Function (is optional) 
  247. Call Procedure 1 
  248. Since the use of CALL is optional, forget you ever saw it 
  249. CallByName - Executes a method of an object or set/returns a property 
  250. CallByName(form1,procedurename,vbMethod) 
  251. The really cool thing about this is that you don't have to hardcode a procedure call. Just use a string variable with the name of the procedure to call. 
  252. Option Explicit - Instructs VB to force an explicit declaration of all variables 
  253. Option Explicit 
  254. You're borderline stupid if you don't use it to catch typing errors. Set up the VB IDE to automatically include this in all projects. 
  255. Option Compare - Instructs VB on how to make string comparisons 
  256. Option Compare Binary 
  257. This can add case-insensitivity for those times when you don't want to hard-code it 
  258. Option Private - Prevents a module's content from being referenced outside a project. 
  259. Option Private Module 
  260. Generally doesn't apply to most VB applications. If you find a good use for it let me know. 
  261. Property Get - Declares how to get the value of a property 
  262. Property Get Name() 
  263. You won't use this much until you get into creating classes of your own 
  264. Property Let - Declares how to assign a value to a property 
  265. Property Let Name() 
  266. You won't use this much until you get into creating classes of your own 
  267. Property Set - Declares how to set a variable reference to an object 
  268.   
  269. You won't use this much until you get into creating classes of your own 
  270. Set - Assigns an object reference to a variable 
  271. Set X = form1.txtInputFromUser 
  272. Very useful for making code more readable or simply to cut down on how much typing you have to do! 
  273. Let - Precedes assignment of a value to a variable 
  274. Let i = 3 
  275. It's optional, no one uses, so forget you ever saw it 
  276. Type...End Type - Creates a user defined part type which consists of standard VB data types 
  277. type anytypename 
  278. one as string 
  279. two as integer 
  280. three as boolean 
  281. End Type 
  282. This is a really excellent way to keep several kinds of data under one variable name. Plus, you can PUT or GET a user-defined type with a single line of code. 
  283. Const - Creates a variable whose value is fixed 
  284. const anyname 
  285. Basically, use this to give easy to remember names to values. For example, suppose you use the value 37.2 a lot in your code, then if you put CONST MyAge = 37.2 in your code you'll be able to insert the MyAge where the 37.2 should have gone. Easier to type and easier to read. Also, you can chane the value of the constant by changing only the declaration line of code, rather than searching out every place the value was used! 
  286. Declare - Used to define a procedure that exists in another file 
  287. declare functionname (arg1 as integer, arg2 as string) as integer 
  288.   
  289. ArrayName = Array (10, 20, 30) 
  290. Implements - Specifies a class to be implemented in a module 
  291.   
  292. Friend - Allows procedure to be callable from modules outside the class 
  293.   
  294. GetObject - Return a reference to an ActiveX component 
  295.   
  296. CreateObject - Creates and returns a reference to an ActiveX object 
  297.   
  298. GetAutoServerSettings - Returns information about the state of an ActiveX component's registration. 
  299.   
  300. Enum - Declares a type for an enumeration 
  301.   
  302. Event - Declares a user-defined event 
  303.   
  304. TypeName - Returns the type of data in a variable 
  305.   
  306. VarType - Returns the type of data in a variable 
  307.   
  308. DefType - Sets the default data type of variables 
  309. DefInt A-Z 
  310. IS - A variety of data type or status checking options 
  311. IsArray, IsBindable, IsBroken, IsDate, IsDirty, IsEmpty, IsError, IsMissing, IsNull, IsNumber, IsObject, IsReady, IsRootFolder 
  312. Date/Time
  313. These functions are pretty self-explanatory so I've not added any extra comments to them.
  314.  
  315. Date - Gets the current date 
  316. Time - Gets the current time 
  317. Now - Gets the current date and time 
  318. Timer - Returns the number of seconds since midnight 
  319. DateAdd - Adds a time interval to a date 
  320. DateDiff - Returns how many time intervals there are between two dates 
  321. DateSerial - Returns the month/day/year 
  322. DateValue - Returns the date 
  323. Year - Returns the current year 
  324. Month - Returns the current month (integer) 
  325. MonthName - Returns the text of the name of a month 
  326. Day - Returns the current day 
  327. Hour - Returns the current hour 
  328. Minute - Returns the current minute 
  329. Second - Returns the current second 
  330. TimeSerial - Returns a date with the hour/minute/second 
  331. TimeValue - Returns the time 
  332. WeekDay - Returns the current day of the week (integer) 
  333. WeekDayName - Returns the text of a day of the week 
  334. Miscellaneous
  335. In this list you'll find some of the features of VB about which I get a lot of email questions! The MsgBox is easily the most used of the bunch. It handles all of the "Y/N" queries to your user so get to know it well. Also, the DoEvents, Shell, and Command functions are indispensable in certain occasions so make sure you know when they should be used.
  336.  
  337. MsgBox - A built-in dialog box that gives a message and allows a user input 
  338. i = msgbox "Read this!", vbokonly, "Test Message" 
  339. DoEvents - Allows VB to complete pending tasks 
  340. doevents 
  341. Shell - Executes a 2nd program from within the current program 
  342. shell "notepad.exe" 
  343. Note - VB does not wait for the Shell'd program to quit before executing the next line of code! 
  344. Command - Gives any text that followed a VB .EXE execution command 
  345. temp$ = command 
  346. Environ - Returns the system environmental space content 
  347. temp$ = environ 
  348. Beep - Makes the computer beep once. 
  349. beep 
  350. InputBox - A built-in dialog box that allows entry of a text string 
  351. inputbox "Input a value!", 5 
  352. AddressOf - Provides an entry point for an external program to use a procedure 
  353. AddressOf ( procedurename ) 
  354. AppActivate - Activates an applications window 
  355. AppActivate ( windowtitle ) 
  356. RaiseEvent - Fires an event declared at module level 
  357. RaiseEvent ProcedureName 
  358. Load - Load an object 
  359. load form1 
  360. Unload - Unload an object 
  361. Unload form1 
  362. LoadPicture - Load a picture into a control property 
  363. form1.picture = loadpicture (filename) 
  364. SavePicture - Save a picture to a file 
  365. SavePicture(form1.picture,filename) 
  366. LoadResData - Load the data from a resource file 
  367. LoadResData(index,format) 
  368. LoadResString - Load a string from a resource file 
  369. LoadResString(index,format) 
  370. SendKeys - Send keys to another app as though they were from the keyboard 
  371. Sendkeys {DOWN} 
  372. QBColor - Returns a value corresponding to the original QB values 0-15 
  373. form1.backcolor = QBcolor (12) 
  374. RGB - Returns a color value by inputting the red, green, and blue parts 
  375. form1.backcolor = RGB (12,128,256) 
  376. Me - Refers to the current object, usually the active form 
  377. print Me.caption 
  378. Registry
  379. I've never quite understood why Microsoft got away from the use of an INI file. The ability to use a simple text editor to resolve problems with a program's settings was a key feature about INI files. Also, no matter how Windows crashed, the INI file was protected.
  380.  
  381. Whining aside, VB has made it incredibly easy to access values in the registry. The following VB functions are simple to use and there's hardly any excuse for not taking advantage of them. One thing to remember is that the registry save strings so if you're saving or reading numeric information then may have to do some string manipulation with the results.
  382.  
  383. GetSetting - Get a value from the Registry 
  384. temp$ = getsetting "TestApp", "SectionName", "KeyName", "defaultvalue" 
  385. GetAllSettings -Returns a list of key settings and their values 
  386. GetAllSettings(appname,section) 
  387. SaveSetting - Save a value into the Registry 
  388. savesetting "TestApp", SectionName, KeyData 
  389. DeleteSetting - Deletes an entry from the registry 
  390. deletesetting "TestApp", "SectionName", "Keyname" 
  391. Loops and Conditional Decisions
  392. While the event-driven model of VB has taken out a lot of the need for controlling the flow of your application, don't think for a second that you can get by without being an expert on these features of VB. Virtually every single procedure you'll ever write will have one or more of these in it. The concepts are simple, so take the time to become a master of each one! The For...Next and the Select Case statements are the two most used, so concentrate on them first.
  393.  
  394. If..Then..Else - Performs code based on the results of a test 
  395. If A>5 Then Print "A is a bit number!" 
  396. For...Next - Loops a specified number of times 
  397. For i = 1 to 5: print #1, i: next i 
  398. For Each ... Next - Walks through a collection 
  399. For Each X in Form1.controls: Next X 
  400. While...Wend - Loops until an event is false 
  401. while i < 5: i = i +1: wend 
  402. Select Case - Takes an action based on a value of a parameter 
  403. select case i 
  404. case 1 : print "it was a 1" 
  405. case 2 : print "it was a 2" 
  406. end select 
  407. Do...Loop - Loops until conditions are met 
  408. do while i < 5 : i = i + 1 : loop 
  409. IIF - Returns 1 of two parts, depending on the value of an expression 
  410. result = IIF (testexpression, truepart, falsepart) 
  411. Choose - Selects and returns a value from a list of arguments 
  412. Choose (index, "answer1", "answer2", "answer3") 
  413. With - Executes a series of statements on a single object 
  414. With textbox1 
  415. .Height = 100 
  416. .Width = 500 
  417. End With 
  418. End - Immediately stops execution of a program 
  419. End 
  420. Stop - Pauses execution of a program (can restart without loss of data) 
  421. Stop 
  422. Switch - Returns a value associated with the first true expression in a list 
  423. result = Switch (testvalue1, answer1, testvalue2, answer2) 
  424. GoTo - Switches execution to a new line in the code 
  425. GoTo Line1 
  426. GoSub ... Return - Switches execution to a new block of code and then returns 
  427. GoSub Line1 
  428. On .. GoSub - Branch to a specific line of code then return at the next Return statement 
  429. On Number GoSub Line1, Line2, Line3 
  430. On .. GoTo - Branch to a specific line of code 
  431. On Number GoTo Line1, Line2, Line3 
  432. Special Values
  433. There are some keywords in VB which take on special meaning. Their use can be confusing at times, but you'll get used to the terminology as your programming experience grows.
  434.  
  435. True - A logical (Boolean) expression. In VB, its value is -1 
  436. X = TRUE 
  437. False - A logical (Boolean expression. In VB, its value is 0 
  438. X = FALSE 
  439. Nothing - Disassociates an object variable from an actual object 
  440. Set X = Nothing 
  441. Null - Indicates that a variable has no valid data 
  442. X = Null 
  443. Empty - Indicates that a variable has not yet been initialized 
  444. X = Empty 
  445. Error Handling
  446. Try as I might, I cannot create error free code! So, I turn to these VB features to help me figure out what went wrong.
  447.  
  448. On Error - Enables an error-handling routine 
  449. On Error GoTo Line2 (if error occurs, go to line2) 
  450. On Error Resume Next (if error occurs, continue executing next line of code) 
  451. On Error Goto 0 (disables error handling) 
  452. Resume - Used to resume execution after a error-handling routine is finished 
  453. Resume 
  454. Resume Next 
  455. Resume Line1 
  456. CVErr - Returns an error type variable containing a user-specific error number 
  457. X = CVError(13) 
  458. Error - Simulates the occurrence of an error 
  459. Error 23 
  460. Financial Calculations
  461. For those folks who want to use VB for performing routine investment calcuations, VB provides a variety of functions. Personally, I use them very infrequently, but I suspect they are used regularly by a lot of programmers. I've never gotten a single question in the mail about these functions!
  462.  
  463. DDB - Returns the depreciation of an asset for a specific time period 
  464. FV - Returns the future value of an annuity 
  465. IPmt - Returns the interest payment of an investment 
  466. IRR - Returns the internal rate of return on a cash flow 
  467. MIRR - Returns a modified internal rate of return on a cash flow 
  468. NPer - Returns a number of periods for an annuity 
  469. NPV - Returns a present value of an investment 
  470. PPmt - Returns the principal payment of an annuity 
  471. PV - Returns the present value of an annuity 
  472. Rate - Returns the interest rate per period for an annuity 
  473. SLN - Returns the straight-line depreciation of an asset 
  474. SYD - Returns the sum-of-years' digits depreciation of an asset 
  475.   
  476.